/**
 * @author:linjiye
 * @date: 2024/12/25
 * @desc:
 **/

import {StyleSheet, Text, View} from 'react-native'
import React, {useEffect, useState} from 'react'
import TabCard from "@/components/TabCard";
import PageFormBtn from "@/components/PageFormBtn";
import SdsrPage from "@/components/aiOriginality/SdsrPage";
import AiInnovationWrap from "@/components/aiInnovation/AiInnovationWrap"
import PageScrollView from "@/components/PageScrollView";
import {useRouter} from "expo-router";
import {useSelector} from "react-redux";
import {set} from "immer/src/utils/common";

type Props = {}

const index = (props: Props) => {
    const [disable, setDisable] = useState(false)
    const router = useRouter();
    const p = useSelector(state => state.aiInnovation.params)

    useEffect(() => {
        if(p) {
            let disable = false
            if(p.remember){
                disable =!(p.groupId  &&  p.profitModelId && p.text)

            } else {
                disable = !p.text
            }
            setDisable(disable)
        }
    }, [p]);

    const handlePageFormBtnClick = (val) => {
        router.navigate(`/aiOriginality/result?fromWay=aiInnovationPage`)
    }
    return (
        <PageScrollView
            isHaveHeader
            isTransparentTab
            pageBottom = {
                <PageFormBtn disable={disable} btnName='生成文案' onPageFormBtnClick={handlePageFormBtnClick}/>
            }
        >
            <AiInnovationWrap isVideoBtn/>
        </PageScrollView>
    )
}

export default index

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: "center",
        alignItems: "center",
    },
})